﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="MAS_Provinces.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.MAS_Provinces" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc2" %>

<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    <title>ข้อมูลภูมิภาค/ประเทศ</title>
    
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">        
            <script type="text/javascript">
                function CollapseSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.collapse();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.collapse();
                    }
                }
                function ExpandSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.expand();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.expand();
                    }
                }

                function closeRadWindow(sender, args) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest('CloseWindow');
                }

                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
 
            </script>
        
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cmdSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdExpand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1"
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdCollapse">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel5" />
                    <telerik:AjaxUpdatedControl ControlID="lblHeader" />
                    <telerik:AjaxUpdatedControl ControlID="lblZoneSeq" />   
                    <telerik:AjaxUpdatedControl ControlID="Panel4" />                 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>                
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Panel4">
                <UpdatedControls>                                     
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="100%" Width="75px" Transparency="50">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <img alt="Loading..." 
                        src="../Images/Buttons/loading.gif" 
                        style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
    <asp:panel ID="Panel6" runat="server" CssClass="contentPanelPaddingTop5px">
    <table width="1000" cellpadding="0" cellspacing="0">

        <tr>
            <td width="280">
                <uc2:user ID="user1" runat="server" />
            </td>
            <td width="10" >
            </td>
            <td valign="top" width="700" >
                <div class="moduleDivSlim700">
                    <div class="moduleDivBottom700">
                        <asp:Panel ID="Panel5" runat="server" >
                            <table align="center" width ="600px" >
                                <tr>
                                    <td align="left" class="formHeader">
                                        <asp:Label ID="lblHeader" runat="server" Font-Bold="True"></asp:Label>
                                        <asp:Label ID="lblZoneSeq" runat="server" Visible ="false" ></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td width="400" valign="top">
                <div class="moduleDivSlim280">
                    <div class="moduleDivBottom280">
                        <asp:Panel ID="Panel1" runat="server" Width="280px" ScrollBars="Auto">
                        <table style="border-bottom-style: double; border-color: #008080" width ="100%">
                                <tr>
                                    <td >
                                        &nbsp;&nbsp; ค้นหา :&nbsp;
                                    </td>
                                    <td >
                                        <telerik:RadTextBox ID="txtSearch" Runat="server">
                                        </telerik:RadTextBox>
                                        <asp:ImageButton ID="cmdSearch" runat="server" onclick="cmdSearch_Click" 
                                            ToolTip="กดปุ่มเพื่อเริ่มค้นหาข้อมูล" 
                                            ImageUrl="~/App_UI/Images/Buttons/Magnifier.gif" />
                                        &nbsp;
                                        <asp:ImageButton ID="cmdExpand" runat="server" 
                                            ImageUrl="../Images/Buttons/ExpandAll.gif" onclick="cmdExpand_Click" 
                                            ToolTip="ขยายทั้งหมด" Height="20px" />
                                        &nbsp;
                                        <asp:ImageButton ID="cmdCollapse" runat="server" 
                                            ImageUrl="../Images/Buttons/CollapseAll.gif" onclick="cmdCollapse_Click" 
                                            ToolTip="ย่อทั้งหมด" Height="20px" />
                                    </td>
                                </tr>
                            </table>
                            
                        </asp:Panel>
                        <asp:Panel ID="Panel2" runat="server" Width="280px" Height="335px" ScrollBars="Auto">
                            <telerik:RadTreeView Runat="server" 
                                ID="RadTreeView1" 
                                DataFieldID="Id" 
                                DataFieldParentID="Parent_id" 
                                DataTextField="Name" 
                                DataValueField="Id" 
                                EnableDragAndDrop="True"
                                onnodeclick="RadTreeView1_NodeClick" 
                                CausesValidation="False" 
                                onnodeexpand="RadTreeView1_NodeExpand" 
                                onnodedrop="RadTreeView1_NodeDrop">
                            </telerik:RadTreeView>
                        </asp:Panel>
                    </div>
                </div>
            </td>
            <td width="10">
            </td>
            <td width="700" valign ="top" >
            <div class="moduleDivSlim700">
                    <div class="moduleDivBottom700">
                        <asp:Panel ID="Panel7" runat="server" Width="700px" ScrollBars="Auto">
                        <table width ="100%">
                                <tr>
                                    <td class ="tableHeader">

                                        <asp:Label ID="lblHeader0" runat="server" Font-Bold="True"></asp:Label>
                                        <telerik:RadTextBox ID="txtSearch0" Runat="server" Visible="False">
                                        </telerik:RadTextBox>

                                    </td>
                                </tr>
                            </table>
                            
                        </asp:Panel>
                        <asp:Panel ID="Panel4" runat="server" Width="700px" Height="370px" ScrollBars ="Auto">
                            <table align ="center">
                            <tr>
                            <td>
                                <telerik:RadGrid 
                                ID="RadGrid1" 
                                runat="server" 
                                AllowFilteringByColumn="True" 
                                AllowPaging="True" 
                                AllowSorting="True" 
                                AutoGenerateColumns="False" 
                                AllowMultiRowSelection="True" 
                                ShowStatusBar="true" 
                                Skin="Outlook"
                                GridLines="None" 
                                EnableAJAXLoadingTemplate="True" 
                                EnableAJAX="True"
                                AllowAutomaticDeletes="True" 
                                AllowMultiRowEdit="True"
                                OnItemCommand="RadGrid1_ItemCommand"
                                Width="690px">
                                <MasterTableView 
                                    AllowMultiColumnSorting="True" 
                                    CellSpacing="-1" 
                                    DataKeyNames="Sequence" 
                                    NoMasterRecordsText="< ไม่มีข้อมูล >"
                                    CommandItemDisplay="Top" 
                                    InsertItemPageIndexAction="ShowItemOnCurrentPage">
                                    <CommandItemTemplate>
                                        <table width="600px" cellpadding="0" cellspacing="0" >
                                            <tr>
                                                <td>
                                                    <asp:LinkButton ID="cmdAddNew" runat="server" CommandName="InitInsert" 
                                                        Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>" CausesValidation="False">
                                                    <img style="border:0px;vertical-align:middle;" alt="" 
                                                    src="../Images/Buttons/AddRecord.gif" /> เพิ่มข้อมูลใหม่</asp:LinkButton>
                                                    &nbsp;&nbsp;
                                                </td>
                                                <td align="right">
                                                </td>
                                            </tr>
                                        </table>
                                    </CommandItemTemplate>

                                    <Columns>
                                        <telerik:GridEditCommandColumn 
                                            EditText = "คลิกเพื่อแก้ไขข้อมูล"
                                            ButtonType="ImageButton"  >
                                            <ItemStyle Width="10px" HorizontalAlign ="Center" />
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridButtonColumn 
                                            ButtonType="ImageButton" 
                                            CommandName="Delete" 
                                            ConfirmText="ลบข้อมูลที่เลือก?" 
                                            Text="คลิกเพื่อลบข้อมูล" 
                                            UniqueName="column1" 
                                            ConfirmDialogType="RadWindow">
                                            <HeaderStyle Width="10px" HorizontalAlign ="Center"/>
                                            <ItemStyle Width="10px" HorizontalAlign ="Center" />
                                        </telerik:GridButtonColumn>
                                        <telerik:GridBoundColumn 
                                            DataField="Sequence" 
                                            DataType="System.Int32" 
                                            Display="False" 
                                            HeaderText="Sequence" 
                                            ReadOnly="True" 
                                            UniqueName="Sequence" 
                                            Visible="False">
                                        </telerik:GridBoundColumn>
                                        
                                        <telerik:GridBoundColumn 
                                            DataField="Name" 
                                            UniqueName="Name" 
                                            FilterControlWidth="100%" 
                                            AutoPostBackOnFilter="true"
                                            CurrentFilterFunction="Contains" 
                                            ShowFilterIcon="False">
                                            <HeaderStyle Width="250px" />
                                            </telerik:GridBoundColumn> 
                                            <telerik:GridBoundColumn 
                                            DataField="NameEng" 
                                            UniqueName="NameEng" 
                                            HeaderText="ชื่อภาษาอังกฤษ" 
                                            FilterControlWidth="100%" 
                                            AutoPostBackOnFilter="true"
                                            CurrentFilterFunction="Contains" 
                                            ShowFilterIcon="False">
                                            <HeaderStyle Width="250px" />
                                            </telerik:GridBoundColumn>                                             
                                        <telerik:GridBoundColumn 
                                            DataField="Remarks" 
                                            HeaderText="หมายเหตุ" 
                                            UniqueName="Remarks" 
                                            FilterControlWidth="100%" 
                                            AutoPostBackOnFilter="true"
                                            CurrentFilterFunction="Contains" 
                                            ShowFilterIcon="False">
                                            <HeaderStyle Width="100px" />
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                    <EditFormSettings EditFormType="WebUserControl">
                                        <EditColumn UniqueName="EditCommandColumn1">
                                        </EditColumn>
                                    </EditFormSettings>
                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" 
                                        FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                                        NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                        PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                                </MasterTableView>
                                <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" 
                                    ReorderColumnsOnClient="True" EnableRowHoverStyle="True">
                                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                </ClientSettings>
                            </telerik:RadGrid>      
                                </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        </div>
                        </div>
            </td>
        </tr>
        
    </table>
    </asp:panel></asp:Content>
